import { defHttp } from '@/utils/http/axios';

// 设备服务入口
export function deviceAction(key, action, data, query) {
  return defHttp.post({
    url: '/sys/device/manage/action',
    method: 'post',
    data: {
      key: key,
      action: action,
      params: data,
    },
    params: query,
  });
}

// 设备列表
export function deviceList(query, data) {
  return defHttp.post({
    url: '/sys/device/manage/list',
    method: 'post',
    params: query,
    data: data,
  });
}

// 分配设备
export function updateAssignDevices(data) {
  return defHttp.post({
    url: '/sys/device/manage/updateAssignDevices',
    method: 'post',
    data: data,
  });
}

// 添加设备
export function saveDevice(data) {
  return defHttp.post({
    url: '/sys/device/manage/saveDevice',
    method: 'post',
    data: data,
  });
}

// 删除设备
export function deleteDevice(id) {
  return defHttp.post({
    url: '/sys/device/manage/deleteDevice/' + id,
    method: 'post',
  });
}

// 获取设备详情
export function getDeviceDetails(id) {
  return defHttp.post({
    url: '/sys/device/manage/details/' + id,
    method: 'post',
  });
}

// 更新设备
export function updateDevice(data) {
  return defHttp.post({
    url: '/sys/device/manage/updateDevice',
    method: 'post',
    data: data,
  });
}

// 解绑设备
export function relieveDevice(data) {
  return defHttp.post({
    url: '/sys/device/manage/relieveDevice',
    method: 'post',
    data: data,
  });
}

// 调试投币
export function deBugCoin(data) {
  return defHttp.post({
    url: '/sys/device/manage/deBugCoin',
    method: 'post',
    data: data,
  });
}
